package com.qys.livesMall.system.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 平台广告管理 状态
 */
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PlatformAdvertisementStateEnum {
    GO_LIVE("上线",0),
    OFFLINE("下线",1),
    ;

    private String name;
    private Integer code;

    public static PlatformAdvertisementStateEnum getEnum(Integer code) {
        for (PlatformAdvertisementStateEnum typeEnum : PlatformAdvertisementStateEnum.values()) {
            if (Objects.equals(typeEnum.getCode(), code)) {
                return typeEnum;
            }
        }
        return null;
    }
}
